
local CLASS_MEDIC = {}
local CLASS_BASE = player_class.Get("Default")

CLASS_MEDIC.WalkSpeed 				= CLASS_BASE.WalkSpeed
CLASS_MEDIC.CrouchedWalkSpeed 		= CLASS_BASE.CrouchedWalkSpeed
CLASS_MEDIC.RunSpeed				= CLASS_BASE.RunSpeed
CLASS_MEDIC.DuckSpeed				= CLASS_BASE.DuckSpeed
CLASS_MEDIC.JumpPower				= CLASS_BASE.JumpPower
CLASS_MEDIC.DrawTeamRing			= CLASS_BASE.DrawTeamRing
CLASS_MEDIC.DrawViewModel			= CLASS_BASE.DrawViewModel
CLASS_MEDIC.CanUseFlashlight      	= CLASS_BASE.CanUseFlashlight
CLASS_MEDIC.MaxHealth				= CLASS_BASE.MaxHealth + 50
CLASS_MEDIC.StartHealth			= CLASS_BASE.StartHealth + 50
CLASS_MEDIC.StartArmor				= CLASS_BASE.StartArmor
CLASS_MEDIC.MaxStamina				= CLASS_BASE.MaxStamina
CLASS_MEDIC.RespawnTime          	= CLASS_BASE.RespawnTime
CLASS_MEDIC.DropWeaponOnDie		= CLASS_BASE.DropWeaponOnDie
CLASS_MEDIC.TeammateNoCollide 		= CLASS_BASE.TeammateNoCollide
CLASS_MEDIC.AvoidPlayers			= CLASS_BASE.AvoidPlayers
CLASS_MEDIC.Selectable				= CLASS_BASE.Selectable
CLASS_MEDIC.FullRotation			= CLASS_BASE.FullRotation

CLASS_MEDIC.DisplayName			= "Human (Medic)"
CLASS_MEDIC.PlayerModel			= "models/player/Combine_sniper_2.mdl"
 
function CLASS_MEDIC:Loadout( pl )
	pl:Give("weapon_crowbar")
	
	pl:Give( "weapon_ak47" )
	pl:GiveAmmo( 25 * 10,  "smg1", true)
	
	CLASS_BASE:Loadout(pl)
	
	pl:SelectWeapon("weapon_ak47")
end
 
 function CLASS_MEDIC:HealthRegenBegin( pl )
	if(timer.IsTimer("health_regen_pl" .. pl:EntIndex()) == false) then
		timer.Create("health_regen_pl" .. pl:EntIndex(), 2, 0, self.RegenHealth, self, pl)
	else
		timer.Start("health_regen_pl" .. pl:EntIndex())
	end
 end
 function CLASS_MEDIC:HealthRegenEnd( pl )
	timer.Destroy("health_regen_pl" .. pl:EntIndex())
 end
 
 function CLASS_MEDIC:RegenHealth( pl )
	if(pl:Health() == pl:GetMaxHealth() or pl:GetPlayerClass().DisplayName ~= self.DisplayName or pl:Alive() == false) then return end
	
	local healAmt = math.Clamp(math.floor(pl:GetMaxHealth() * 0.03), 0, 5)
	
	pl:SetHealth( math.Clamp(pl:Health() + healAmt, 1, pl:GetMaxHealth()) )
	
	//pl:ChatPrint("[MEDIC] You healed "..healAmt.." damage automatically.")
 end
 
function CLASS_MEDIC:OnSpawn( pl )
	self:HealthRegenBegin(pl)
	pl:SetColor(64, 64, 255)
	
	CLASS_BASE:OnSpawn( pl )
end
 
function CLASS_MEDIC:OnDeath( pl, attacker, dmginfo )
	self:HealthRegenEnd(pl)
	
	CLASS_BASE:OnDeath( pl, attacker, dmginfo )
end
 
function CLASS_MEDIC:Move( pl, mv )
	CLASS_BASE:Move( pl, mv )
end

function CLASS_MEDIC:ShouldDrawLocalPlayer( pl )
	return false
end
 
 
player_class.Register( "human_medic", CLASS_MEDIC )
